package com.yc.cloud.openai.portal.controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yc.cloud.common.basic.api.ResponseResult;
import com.yc.cloud.common.basic.dto.BaseQueryParam;
import com.yc.cloud.common.orm.CommonPage;
import com.yc.cloud.openai.portal.dto.request.ImageRecordListParam;
import com.yc.cloud.openai.portal.service.ImageRecordService;
import com.yc.cloud.openai.vo.ImageRecordVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import lombok.val;

/**
 * AIGC/图片模块
 */
@RestController
@RequestMapping("image/record")
@Api(value = "AI绘画记录", tags = "AI绘画记录")
public class ImageRecordController {

    @Resource
    private ImageRecordService imageRecordService;

    @GetMapping
    @ApiOperation(value = "AI绘画记录列表", notes = "分页查询,字段模糊匹配,排序等")
    public ResponseResult<CommonPage<ImageRecordVo>> list(@Validated ImageRecordListParam param,
            @Validated BaseQueryParam queryParam) {
        val result = imageRecordService.list(param, queryParam);
        return ResponseResult.success(CommonPage.restPage(result));
    }

    // @GetMapping("{id}")
    // @ApiOperation(value = "AI绘画记录详情", notes = "根据ID查询")
    // public ResponseResult<ImageRecord> get(@PathVariable @ApiParam(value = "ID",
    // required = true) Long id) {
    // val result = imageRecordService.get(id);
    // return ResponseResult.success(result);
    // }
    //
    //
    // @PostMapping
    // @ApiOperation(value = "添加AI绘画记录", notes = "添加")
    // public ResponseResult<ImageRecord> create(@Validated @RequestBody ImageRecord
    // param) {
    // val result = imageRecordService.create(param);
    // return result != null ? ResponseResult.success(result) :
    // ResponseResult.failed();
    // }
    //
    //
    // @ApiOperation(value = "删除AI绘画记录", notes = "通过ID删除")
    // @DeleteMapping(value = "{id}")
    // public ResponseResult<Boolean> delete(@PathVariable @ApiParam(value = "ID",
    // required = true) Long id) {
    // val result = imageRecordService.delete(id);
    // return result ? ResponseResult.success(true) : ResponseResult.failed();
    // }
    //
    //
    // @ApiOperation(value = "修改AI绘画记录", notes = "通过ID修改")
    // @PutMapping(value = "{id}")
    // public ResponseResult<ImageRecord> update(@PathVariable @ApiParam(value =
    // "ID", required = true) Long id, @Validated @RequestBody ImageRecord param) {
    // val result = imageRecordService.update(id, param);
    // return result != null ? ResponseResult.success(result) :
    // ResponseResult.failed();
    // }
}
